<?php

namespace App\Http\Requests\UserFollow\V10;

use App\Constant\UserFollowTypeCode;
use App\Models\UserFollow;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

class UserFollowRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'type' => ['required'],
            'code' => 'required|size:3',
            'response' => '',
            'type_desc' => '',
            'channel' => '',
            'mac_address'=>'max:100',
            'device'=>['required', Rule::in([UserFollow::DEVICE_IOS,UserFollow::DEVICE_ANDROID,UserFollow::DEVICE_H5])],
        ];
    }

    public function messages()
    {
        return [
            'type.required' => '缺少节点编号',
            'code.required' => '响应代码必须填写',
            'code.size' => '响应代码为3位',
            'mac_address.max' => '手机mac地址最多100位',
            'device.required' => '缺少设备信息',
            'device.in' => '设备信息不是可选范围',
        ];
    }
}
